package fatworm.concept.datatype;
/**
 * data type BOOLEAN
 */
public class FatBoolean extends fatworm.concept.DataType{
	private static final FatBoolean instance = new FatBoolean();
	public static FatBoolean getInstance(){
		return instance;
	}
	
	private FatBoolean(){}
	
	public BooleanValue createValue( boolean value ){
		return new BooleanValue( value  );
	}
	
	public String toString(){
		return "BOOLEAN";
	}
	public int getTypeKey(){
		return T_BOOLEAN;
	}
	public BooleanValue convert( SqlValue value )
		throws ConvertException{
		switch( value.getType().getTypeKey() ){
			case T_BOOLEAN : return (BooleanValue)value;
			default		   : throw new ConvertException( value , this );
				
		}
	}
	
	public class BooleanValue extends SqlValue{
		public boolean value ;
		private BooleanValue( boolean value  ){
			this.value = value;
		}
		public String toString(){
			return Boolean.toString( value );
		}
	}
	
}
